let storage = bui.storage();
loader.define(function (require, exports, module, global) {

    var pageview = {};

    pageview.init = function () {
        // let msg = ""
        // let url = window.location.href
        // if (url.indexOf("?") > -1) {
        //     let param = url.split("?")[1]
        //     msg = param.split("=")[1]
        //     if (msg == '0') {
        //         msg = "登录失败"
        //     }
        // }
        let params = bui.history.getParams(module.id);

        router.$("#msg").text(params.msg)

        router.$("#loginError").click(function () {
            if (isWeiXin()) {
                location.href = global.api.gzhAuthor
            } else {
                location.href = global.api.htmlAuthor
            }
        })
    }

    // 初始化
    pageview.init();

    // 输出模块
    return pageview;
})

function isWeiXin() {
    let ua = navigator.userAgent.toLowerCase()
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
        return true
    } else {
        return false
    }
}
